//
//  DevelopDefine.h
//  DailyRecord
//
//  Created by Gin on 2022/3/25.
//

#ifndef DevelopDefine_h
#define DevelopDefine_h

#ifdef DEBUG
  #define NSLog(FORMAT, ...) fprintf(stderr, "[%s(%d):%s]\t%s\n",[[[NSString stringWithUTF8String:__FILE__] lastPathComponent] UTF8String], __LINE__, __func__, [[NSString stringWithFormat:FORMAT, ##__VA_ARGS__] UTF8String]);
#else
  #define NSLog(FORMAT, ...) nil
#endif

#define kWeakSelf(type)   __weak typeof(type) weak##type = type;

#define kStrongSelf(type) __strong typeof(type) type = weak##type;

#define kScreenWidth    [UIScreen mainScreen].bounds.size.width

#define kScreenHeight   [UIScreen mainScreen].bounds.size.height

#define kScreenSize     [UIScreen mainScreen].bounds.size

#define kColorWithHex(rgbValue, a) \
[UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16)) / 255.0 \
green:((float)((rgbValue & 0xFF00) >> 8)) / 255.0 \
blue:((float)(rgbValue & 0xFF)) / 255.0 alpha:a]

#define kAppVersion         [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"]

#define SYNTHESIZE_SINGLETON_FOR_CLASS_HEADER(className) \
\
+ (className *)shared##className;
#define SYNTHESIZE_SINGLETON_FOR_CLASS(className) \
\
+ (className *)shared##className { \
static className *shared##className = nil; \
static dispatch_once_t onceToken; \
dispatch_once(&onceToken, ^{ \
shared##className = [[self alloc] init]; \
}); \
return shared##className; \
}

#define kSafeAreaInsets \
({UIEdgeInsets edge;\
if (@available(iOS 11.0, *)) { edge = [UIApplication sharedApplication].delegate.window.safeAreaInsets; } else { edge = UIEdgeInsetsZero; }\
(edge);\
})\

#define kNavigationBarHeight (kSafeAreaInsets.top + 44)

#define kTabbarHeight (kSafeAreaInsets.bottom + 49)

#define kBottomAreaHeight kSafeAreaInsets.bottom


#endif /* DevelopDefine_h */
